package com.student_system.students.mapper;

import com.student_system.students.entity.StudentCourse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ljy
 * @since 2025-05-14
 */
public interface StudentCourseMapper extends BaseMapper<StudentCourse> {
    @Select("SELECT * FROM student_course WHERE student_no = #{studentNo}")
    List<StudentCourse> selectByStudentNo(@Param("studentNo") String studentNo);

    @Delete("DELETE FROM student_course WHERE student_no = #{studentNo}")
    int deleteByStudentNo(@Param("studentNo") String studentNo);

    @Select("SELECT course_no as courseNo, grade FROM student_course WHERE student_no = #{studentNo}")
    List<Map<String, Object>> selectGradesByStudentNo(Integer studentNo);
}
